package com.jds.apps.hr.skill.category.form;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.jds.apps.hr.skill.category.form.ext.AbstractCategorySearchForm;

/**
 * 
 */
public class SearchCategoryForm extends AbstractCategorySearchForm {

	private List categories = null;

	private boolean searchMode;

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		ActionErrors errors = new ActionErrors();

		// TODO Implement validation

		return errors;
	}

	/**
	 * @return Returns the categories.
	 */
	public List getCategories() {
		return categories;
	}

	/**
	 * @param categories
	 *            The categories to set.
	 */
	public void setCategories(List categories) {
		this.categories = categories;
	}

	/**
	 * @return Returns the search results size.
	 */
	public int getListSize() {
		if (categories == null) {
			return -1;
		}
		return categories.size();
	}

	/**
	 * @return Returns the hasResult.
	 */
	public String getRecordCount() {
		return Integer.toString(getListSize());
	}

	/**
	 * @return Returns the messageKey.
	 */
	public String getMessageKey() {

		if (0 == getListSize()) {
			return "search.zeroresult";
		} else {
			return "search.resultcount";
		}
	}

	/**
	 * @return Returns the searchMode.
	 */
	public boolean isSearchMode() {
		return searchMode;
	}

	/**
	 * @param searchMode
	 *            The searchMode to set.
	 */
	public void setSearchMode(boolean searchMode) {
		this.searchMode = searchMode;
	}

}
